<?php
namespace app\admin\validate;

use think\Validate;

class Document extends Validate
{
         protected $rule =   [
            'title'  => 'require|unique:document',
            'model_id'   => 'require|number',
            'cate_id' =>'require|number',
            'attr' =>'require|number',
        ];

        protected $message  =   [
           'title.require' =>'文章标题不得为空！',
           'title.unique' =>'文章标题不得重复',

           'model_id.require' => '所属模型不得为空！',
           'model_id.number' =>'所属模型必须是数字',

           'cate.require' => '所属栏目不得为空！',
           'cate.number' =>'所属栏目必须是数字',

           'attr.require' => '文章属性不得为空！',
           'attr.number' =>'文章属性必须是数字',

        ];

        protected $scene = [
            'edit'  =>  ['title','model_id','cate_id','attr'],
            'add'  =>  ['title','model_id','cate_id','attr'],
        ];

}












?>